Dataset Views
A dataset view is a type of reference dataset that points to another dataset as its source. Dataset views allow you to create a customized view of a dataset for users with access to the application where the dataset view resides. Dataset views only belong to a single application; however, the source dataset can belong to a different application. Dataset views are recommended whenever you want to share data amongst users with access to different applications and avoid replicating and copying large datasets.
Creating a Dataset View (Composer)
Create a new dataset view by clicking New Dataset from the Datasets page. Click on the Shared Data tab, select a shared dataset as the source, and then click New Dataset View. Dataset views can only be created if at least one shared dataset exists in at least one application.
Note that the name of the owner and the app in which the original dataset was created are shown for all shared datasets.
From the Design page you can perform the following actions on a dataset view:
- Activate or deactivate individual columns
- Change friendly column names
- Change column visualization formats
- Create geolocation groups
- Set column links
The following actions are restricted for dataset views:
- Edit connection settings and/or source queries
- Create dataset joins
- Create and modify transformations
- Change column data types
- Change column input formats
- Set row-level security
- Set unique identifiers
- Define data sync schedules
In summary, any action that would change the underlying data structure is restricted for dataset views.
You can see which datasets have been created as dataset views by looking at the Type property from the main Datasets page.
Creating a Dataset View (API)
Creating a dataset view programmatically is a three step process, assuming you must first create a shared dataset:
- Designate a dataset as a shared dataset.
- Retrieve the connection ID of the shared dataset.
- Create a new dataset view with the source dataset’s connection ID.
Use the following API endpoint to designate the source dataset as a shared dataset:
https://{{DOMAIN}}.qrveyapp.com/api/v4/user/{{USER_ID}}/app/{{APP_ID}}/qollect/dataset/{{DATASET_ID}}/publishVersion?runPublicTrigger=true
You must also define a request body with the “isPublic” property set to “true”:
{
“isPublic”: true
}
The following parameters must be defined for the API endpoint:
- DOMAIN is the 5-letter subdomain of your Qrvey instance
- USER_ID parameter should be the ID of the user that owns the application where the dataset was created
- APP_ID is the ID of the application where the dataset was created
- DATASET_ID is the ID of the dataset that is to become a shared dataset.
You can get the ID of the dataset by entering the Design view for the target dataset and inspecting the URL:
https://{{DOMAIN}}.qrveyapp.com/app/index.html#/application/{{APP_ID}}/data-uploads/{{DATASET_ID}}
After designating the dataset as a shared dataset, the next step is to create a new dataset view that will use the shared dataset as its source. The first step is to call the following API endpoint to retrieve the shared dataset’s connection ID:
https://{{DOMAIN}}.qrveyapp.com/devapi/v4/user/{{USER_ID}}/app/{{APP_ID}}/qollect/dataset/{{DATASET_ID}}
From the JSON response, retrieve the “connectionId” property value, which you will use in the next and final API call.
Once you have the connection ID for the source shared dataset, call the following API endpoint to create a new dataset view:
https://{{DOMAIN}}.qrveyapp.com/api/v4/user/{{USER_ID}}/app/{{APP_ID}}/qollect/dataset/clone/connection/{{CONNECTION_ID}}
For this API call, the user ID and app ID must be the ID of the target application and the ID of the user owner for the target application where the new dataset view will be created.
You must also define the app ID and user ID of the source application where the source dataset resides within the API call’s request body:
{
appId: “{{APP_ID}}”,
userId: “{{USER_ID}}”
}